package com.mengniu.commerce.sync.api;

import com.mengniu.commerce.common.core.constant.SecurityConstants;
import com.mengniu.commerce.common.core.constant.ServiceNameConstants;
import com.mengniu.commerce.sync.api.base.MnResult;
import com.mengniu.commerce.sync.api.domain.MemberInsertModel;
import com.mengniu.commerce.sync.api.domain.MemberModifyModel;
import com.mengniu.commerce.sync.api.domain.MemberRegisterModel;
import com.mengniu.commerce.sync.api.factory.RemoteMemberFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestPart;

import java.util.List;


/**
 * 数据同步 --会员服务
 *
 * @author yz_sm
 */
@FeignClient(contextId = "RemoteMemberService", value = ServiceNameConstants.DATA_SYNC_SERVICE, fallbackFactory = RemoteMemberFallbackFactory.class)
public interface RemoteMemberService
{
    /**
     * 存量会员创建
     *
     * @param  list 存量会员创建集合
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping(value = "/member/memberInsert")
     MnResult memberInsert(@RequestBody List<MemberInsertModel> list, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 会员注册
     *
     * @param   memberRegisterModel
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping(value = "/member/memberRegister")
    MnResult memberRegister(@RequestBody MemberRegisterModel memberRegisterModel,  @RequestHeader(SecurityConstants.FROM_SOURCE) String source,@RequestPart(value = "userId")String userId);

    /**
     * 会员修改
     *
     * @param  memberModifyModel 会员修改
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping(value = "/member/memberModify")
    MnResult memberModify(@RequestBody MemberModifyModel  memberModifyModel, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
